<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/jsp/public/common.jspf" %>

<html>
<head>
    <title>权限设置</title>

    <!--jquery tree widget-->
    <script type="text/javascript" src="${pageContext.request.contextPath}/scripts/jquery_ui/jquery-ui.js"></script>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/scripts/jquery_ui/jquery-ui.css"/>
    <script type="text/javascript"
            src="${pageContext.request.contextPath}/scripts/jquery_tree_widget/jquery.tree.min.js"></script>
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/scripts/jquery_tree_widget/jquery.tree.min.css"/>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#tree').tree({
                /* specify here your options */
            });
        });
    </script>
</head>
<body>
<div class="col-sm-9">
    <div class="row">
        <div class="col-lg-12">
            <div class="page-header">
                <h1>角色管理</h1>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-default bootstrap-admin-no-table-panel">
                <div class="panel-heading">
                    <div class="text-muted bootstrap-admin-box-title">偏好设置</div>
                </div>
                <div class="bootstrap-admin-no-table-panel-content bootstrap-admin-panel-content collapse in">
                    <s:form cssClass="form-horizontal" action="roleManage_setPrivilege?id=%{id}">
                        <fieldset>
                            <legend>为【${name}】设置权限</legend>
                            <div class="row">
                                <div class="col-md-12">
                                    <!--权限设置-->
                                        <%--<s:checkboxlist list="#privilegeList" listKey="id" listValue="name"--%>
                                        <%--name="privilegeIds"></s:checkboxlist>--%>
                                    <ul id="tree">
                                        <s:iterator value="#privilegeList">
                                            <s:if test="parent==null&&type==1">
                                                <li>
                                                    <input type="checkbox" value="${id}" name="privilegeIds"
                                                           id="cb_${id}"
                                                        <s:property value="id in privilegeIds?'checked':''"/>
                                                            ><label for="cb_${id}">${name}</label>
                                                    <s:if test="children!=null">
                                                        <ul>
                                                            <s:iterator value="children">
                                                                <li>
                                                                    <input type="checkbox" value="${id}"
                                                                           name="privilegeIds"
                                                                           id="cb_${id}"
                                                                        <s:property
                                                                                value="id in privilegeIds?'checked':''"/> >
                                                                    <label for="cb_${id}">${name}</label>
                                                                </li>
                                                            </s:iterator>
                                                        </ul>
                                                    </s:if>
                                                </li>

                                            </s:if>
                                        </s:iterator>
                                    </ul>
                                </div>
                            </div>

                            <hr>

                            <div class="row">
                                <div class="col-lg-10 col-lg-offset-2">
                                    <button type="submit" class="btn btn-primary">保存</button>
                                </div>
                            </div>
                        </fieldset>
                    </s:form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>
